﻿/// <reference path="../Core.ts" />

module Supernova {

    export class BodyFacilities {

        public shipyard: boolean = false;
        public comms: boolean = false;
        public science: boolean = false;
        public orbitals: number = 0;
        public mine: boolean = false;
        public scanner: boolean = false;
        public artillery: BodyFacilityArtillery = null;

        public static getInfo(body: Body, name: string): any {
            var science = galaxy.profile.science;
            var gold = galaxy.profile.gold;
            var population = body.population | 0;
            switch (name) {

                case 'science':
                    return {
                        cost: config.facilityCosts.science,
                        stats: ['Old Science: ⓢ ' + (science.rate.noFacility * population).toFixed(2) + '/s',
                            'New Science: ⓢ ' + (science.rate.withFacility * population).toFixed(2) + '/s']
                    };

                case 'scanner':
                    return {
                        cost: config.facilityCosts.scanner,
                        stats: ['Old Range: ' + (config.scanning.range.noFacility * (galaxy.research.passive.efficientScanners ? 1.25 : 1)).toFixed(2) + ' AU',
                            'New Range: ' + (config.scanning.range.withFacility * (galaxy.research.passive.efficientScanners ? 1.25 : 1)).toFixed(2) + ' AU']
                    };

                case 'shipyard':
                    return {
                        cost: config.facilityCosts.shipyard,
                        stats: []
                    };

                case 'comms':
                    return {
                        cost: config.facilityCosts.comms,
                        stats: ['Old Gold: ◍ ' + (gold.rate.noComms * population).toFixed(2) + '/s',
                            'New Gold: ◍ ' + (gold.rate.withComms * population).toFixed(2) + '/s']
                    };

                case 'mine':
                    return {
                        cost: config.facilityCosts.mine,
                        stats: ['Gold: + ◍ ' + gold.rate.withMines + ' /s']
                    };

                case 'artillery':
                    return {
                        cost: config.facilityCosts.artillery,
                        stats: ['Strength: ' + galaxy.research.artillery.planetary.strength,
                            'Radius: ' + (galaxy.research.artillery.planetary.radius).toFixed(2) + ' AU',
                            'Orbitals: ' + (galaxy.research.artillery.planetary.ignoreOrbitals ? 'Bypassed' : 'Damage orbitals first')]
                    };

                case 'orbital':
                    return {
                        cost: config.facilityCosts.orbital,
                        stats: []
                    };

                default: return null;
            }
        }

    }

}